#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include <DxErr.h>
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment(lib, "DxErr.lib")



enum playerCommands
{
	NONE,
	LEFT,
	RIGHT,
	UP,
	SWING,
	CAST,
	CHARGE,
	CREATESPELL,
	INVCHECK,
	CRAFTCHECK,
	SAVE,
};




enum e_GameState
{
	NO_STATE,
	STATE_NETWORK_CANT_CONNECT,
	STATE_INTRO_MENU,		//Choose between play, options, quit
	STATE_SELECT_GAMETYPE,	//Choose between singleplayer and multiplayer
	/*	*/STATE_LOAD_PRELOADED_GAME,
	/*	*/STATE_LOAD_SINGLE_GAME,	
	/*	*//*  */STATE_LOAD_SINGLE_GAME_LOAD_MAP,
	/*	*//*  */STATE_LOAD_SINGLE_GAME_NEW_MAP,
	/*	*/STATE_MULTI_GAME_SELECT,
	/*  *//*  */STATE_LOAD_MULTI_GAME_CLIENT,
	/*  *//*  */STATE_LOAD_MULTI_GAME_SERVER,
	/*	*//*  *//*  */STATE_LOAD_MULTI_GAME_LOAD_SERVER,
	/*	*//*  *//*  */STATE_LOAD_MULTI_GAME_NEW_SERVER,
	/*	*//*  *//*  *//*  */STATE_LOAD_MULTI_GAME_NEW_SERVER_NEW_MAP,
	/*	*//*  *//*  *//*  */STATE_LOAD_MULTI_GAME_NEW_SERVER_OLD_MAP,
	STATE_GAME,
	/*  */STATE_GAME_CONTROLS,
	/*  */STATE_GAME_CHAT,
	/*	*/STATE_GAME_INVENTORY,
	/*	*/STATE_GAME_OPTIONS,
	/*	*/STATE_GAME_CRAFT,
	/*	*/STATE_GAME_RELOAD_WORLD,
	STATE_QUIT
};

enum e_AssetType
{
	ASSET_WORLD,
	ASSET_INVENTORY,
	ASSET_ACTIONBAR,
	ASSET_GUI,
	ASSET_TYPES
};
enum e_drawlists
{
	DRAW_ENTITIES,
	DRAW_GUI,
	DRAW_BACKDROP,
	NUM_DRAWLISTS
};

enum e_objectType
{
	TYPE_WORLD,
	TYPE_ATMOSPHERE,
	TYPE_PLAYER_PIECE,
	TYPE_ENTITY_PIECE,
	TYPE_GUI,
	OBJECT_TYPES,
	ERROR_TYPE
};

enum e_MouseButtons
{
	LMB,
	RMB,
	MIDDLE_MOUSE_BUTTON
};

enum e_GraphicsLights
{
	LIGHT_WORLD,
	LIGHT_PLAYER,
	LIGHTS_USED
};

struct color
{
	unsigned red, green, blue;
	color() : red(0), green(0), blue(0) {}
	color(int r, int g, int b) : red(r), green(g), blue(b) {}
	//color operator=(int i) { red = green = blue = i; }
	color(int i) : red(i), blue(i), green(i) {}
};

struct GameAsset
{
	bool				useMesh;
	ID3DXMesh*			pObjMesh;
	IDirect3DTexture9*	pObjTex;
	const char*			cszMeshFileName;
	const char*			cszTexFileName;
	RECT*				pBlitData;			// what area of the texture to blit for drawing (set to NULL if not using one)
	color				Color;

	GameAsset(): useMesh(false), pObjMesh(NULL), pObjTex(NULL), cszMeshFileName(NULL), cszTexFileName(NULL) {}
	GameAsset(bool useMesh, ID3DXMesh* mesh, const char* meshFile, IDirect3DTexture9* tex, const char* texFile, RECT* pBlit)
		: useMesh(useMesh)
		, pObjMesh(mesh)
		, pObjTex(tex)
		, cszMeshFileName(meshFile)
		, cszTexFileName(texFile)
		, pBlitData(pBlit)
		, Color(-1)
	{}

	void SetBlitData(RECT* pBlit) { pBlitData = pBlit; }
};
